// user服务
define('userServers', ['angular','jquery'], function (angular,$) {
    var module = angular.module('servers');
    module.factory('userServers', ['$http','Urlconfig',function($http,Urlconfig) { 
        var obj = {
            //获取人员列表/company/list
            userList: function () {
                return $http({
                    method  : 'GET',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users',
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                }).then(function (response) {
                    return response.data;
                });
            },
            setUserList:function(obj){
                return $http({
                    method  : 'POST',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users/set',
                    data:$.param({jsonStr:angular.toJson(obj)}),
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                }).then(function (response) {
                    return response.data;
                });
            },
            delUser:function(info){
                return $http({
                    method  : 'DELETE',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users/del',
                    data:$.param({id:info.id}),
                    cache:true,
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                });
            },
            setUser:function(info){
                return $http({
                    method  : 'POST',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users/setuser',
                    data:$.param(info),
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                });
            },
            getUser:function(info){
                return $http({
                    method  : 'GET',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users/getuser',
                    data:$.param(info),
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                });
            },
            addUser:function(info){
                return $http({
                    method  : 'POST',
                    url: 'http://'+Urlconfig.apiUrl+':8888/api/users/add',
                    data:$.param(info),
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
                });
            }
        };
        return obj;
    }]);
});